package com.lestv.httpUtil;

import com.lestv.jsonBeans.BaseBean;

import android.os.Handler;
import android.os.Message;
import android.util.Log;




public class NetHandler extends Handler {
	public static final int success = 100;
	public static final int fail = 101;
	public static final int error = 102;
	private OnComplteListener onComplteListener;

	public NetHandler(OnComplteListener onComplteListener) {
		this.onComplteListener = onComplteListener;
	}

	@Override
	public void handleMessage(Message msg) {
		super.handleMessage(msg);
		if (onComplteListener != null) {
			switch (msg.what) {
				case success:
					onComplteListener.success((BaseBean) msg.obj);
					break;
				case fail:
					onComplteListener.fail();
					break;
				case error:
					onComplteListener.error((Exception) msg.obj);
					break;
				default:
					break;
			}
		}
	}
}
